<?php require VIEWPATH. ADMIN_DIR. DIRECTORY_SEPARATOR. 'header.php'?>
	<link rel="stylesheet" href="<?=$staticAdminUrl?>assets/css/workflow.css" />
	<div class="page-header">
		<h1><?=$workflowInfo['workflow_title']?> 表单设计器</h1>
	</div>

	<div class="row">
		<div class="col-sm-10">
			<div id="workflow-design-process">
			</div>
		</div>
		<div class="col-sm-2">
			<div class="widget-box transparent">
				<div class="widget-body">
					<div class="widget-main no-padding">
						<div id="process-item"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
<?php require VIEWPATH. ADMIN_DIR. DIRECTORY_SEPARATOR. 'footer.php'?>
<!-- 表单js -->
<script src="<?=$staticAdminUrl?>assets/js/jsplumb.min.js"></script>
<script src="<?=$staticAdminUrl?>assets/js/workflow.js"></script>
<script type="text/javascript">
	$(function(){
		// 初始化表单内容
		$(document).workflowProcessDesign({
			"draggableDom": $("#process-item"),
			"droppableDom": $("#workflow-design-process"),
			"nodeJson": <?=$workflowInfo['workflow_process'] ? $workflowInfo['workflow_process'] : "{}"?>,
			"callback": function(processData){
				// 保存表单结构
				var actionUrl = "<?=admin_url('workflow/save_workflow_process')?>";
				var params = {
					"workflow": "<?=$workflowInfo['id']?>",
					"workflow_process": processData
				};
				ajax_post(actionUrl, params, function(res) {
					window.location.href = "<?=admin_url('workflow/process')?>";
				})
			}
		})
	})
</script>